/**
 * Copyright 2009 Adam Ruggles.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.code.sapien.security;

import com.google.code.sapien.model.Category;
import com.google.code.sapien.model.User;

/**
 * An online user represents a user logged in to the forums (an active user session). 
 * @author Adam
 * @version $Id: SecurityDetails.java 30 2010-01-10 19:05:55Z a.ruggles $
 * 
 * Created on Mar 4, 2009 at 8:49:36 PM 
 */
public interface SecurityDetails {

	/**
	 * Checks if the specified permissions are part of the permissions associated with the category in this security
	 * details entry.
	 * @param category The category the permissions to be checked for are associated with.
	 * @param permissions The permissions to be checked for.
	 * @return True if the permissions are part of the permissions in this entry for the specified category,
	 * false otherwise.
	 */
	boolean checkCategory(Category category, CategoryPermissions permissions);

	/**
	 * Returns the IP address of the remote user.
	 * @return The IP address of the remote user.
	 */
	String getIpAddress();

	/**
	 * Returns the online user.
	 * @return The user, or null if the user is anonymous.
	 */
	User getUser();

	/**
	 * Returns if the security details represents an administrator user.
	 * @return true, if the security details represents an administrator user, otherwise false.
	 */
	boolean isAdministrator();

	/**
	 * Returns if the security details represents an anonymous user.
	 * @return true, if the security details represents an anonymous user, otherwise false.
	 */
	boolean isAnonymous();

	/**
	 * Sets the IP Address of the remote user.
	 * @param ipAddress The IP address to set.
	 */
	void setIpAddress(String ipAddress);
}
